widget: Push a transform node if we need to
authorTimm Bäder <mail@baedert.org>
Sat, 16 Feb 2019 14:29:05 +0000 (15:29 +0100)
committerTimm Bäder <mail@baedert.org>
Sat, 16 Feb 2019 14:44:46 +0000 (15:44 +0100)
This is the same as the old code since the transformation only contains
teh offset right now, but it will be different later where arbitrary
transformations are possible per widget.

gtk/gtkwidget.c

index 26dfa424e12bfcfb1b73fecabf474b02defca71a..4e6ea25321d8ed96dcaa4b7efc8404ca6b560473 100644 (file)
@@ -13528,16 +13528,21 @@ gtk_widget_snapshot_child (GtkWidget   *widget,
                            GtkWidget   *child,
                            GtkSnapshot *snapshot)
 {
-  int x, y;
+  GtkWidgetPrivate *priv = gtk_widget_get_instance_private (child);
+  gboolean needs_transform;
 
   g_return_if_fail (_gtk_widget_get_parent (child) == widget);
   g_return_if_fail (snapshot != NULL);
 
-  gtk_widget_get_origin_relative_to_parent (child, &x, &y);
+  needs_transform = !graphene_matrix_is_identity (&priv->transform);
+
+  if (needs_transform)
+    gtk_snapshot_push_transform (snapshot, &priv->transform);
 
-  gtk_snapshot_offset (snapshot, x, y);
   gtk_widget_snapshot (child, snapshot);
-  gtk_snapshot_offset (snapshot, -x, -y);
+
+  if (needs_transform)
+    gtk_snapshot_pop (snapshot);
 }
 
 /**